<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\common\library\Gps;

/**
 * create by PhpStorm 2025/9/23 13:52
 * bus.com app\api\controller@Bus
 * 行止之行 <xingzhi8711@gmail.com>
 * 公交
 */
class Bus extends Api
{
    protected $noNeedLogin="*";
    protected $noNeedRight="*";
    /*
     *  车牌号：粤S00332D
        车牌号：粤S10283D
        车牌号：粤S25283D
        车牌号：粤S03178D
     * */
    /*获取定位*/
    public function locate()
    {
        $cardid=$this->request->post('cardid');
        $gps=new Gps();
        $res=$gps->getVehBatch($cardid);
        $result=json_decode($res,true);
        $this->success('ok',$result);
    }
    //获取轨迹
    public function seltrack()
    {
        $gps=new Gps();
        $res=$gps->getSeltrack([
            'c_regnum'=>$this->request->post('cardid'),
            'd_begintime'=>$this->request->post('begintime',date("Y-m-d H:i:s",time()-3600)),
            'd_endtime'=>$this->request->post('endtime'),
        ]);
        $result=json_decode($res,true);
        $this->success('ok',$result);
    }
}